package org.peterf.foxish.component.updater;

import org.peterf.foxish.component.property.Updatable;
import org.peterf.foxish.component.updater.interfaces.Updater;

public class MultipleUpdater implements Updater {

    private Updater[] updaters;
    
    public MultipleUpdater(Updater[] updaters) {
        this.updaters = updaters;
    }
    
    public boolean isFinished() {
        for (Updater u : updaters) {
            if (!u.isFinished()) {
                return false;
            }
        }
        return true;
    }

    public void reset() {
        for (Updater u : updaters) {
            u.reset();
        }
    }

    public void update(Updatable updatable, float elapsed) {
        for (Updater u : updaters) {
            u.update(updatable, elapsed);
        }
    }

}
